[C#/WPF] Combo box Item source = ObservableCollection & I need a '-None-' dummy entry at the top

Posted by James on Stack Overflow See other posts from Stack Overflow or by James
Published on 2010-04-13T11:09:45Z Indexed on 2010/04/13 11:13 UTC
Read the original article Hit count: 1006

I have a combo box using an observable collection as a datasource and I want a "dummy" value of "None" as the first item in the box as it controls filters against other data sources.

Other databound objects also use the same observable collection so adding a "None" value directly to the datasource is not possible as I dont want, for example, my datagrids having a "none" in them. Also I'd rather avoid filters to just remove the "none" value for those that do not use it, as I'd like the observable collection to direclty reflect the database data; if at all possible. I'd also like to avoid having one observable collection per databound control.

What I'm really after is a was to put a, non data bound, first entry into a combobox while also having the item source pointed at an obervable collection.

Thanks

© Stack Overflow or respective owner

Related posts about c#

Related posts about wpf